package cn.glutnn.oss.config;

import io.minio.MinioClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Author:   msh
 * Date:     2024/12/4 下午5:28
 * Description:
 */

@Configuration
public class MinioConfig {
    // MinIO服务器地址
    @Value("${minio.url}")
    public  String MINIO_URL;
    // 存储桶名称
    @Value("${minio.bucketName}")
    public String MINIO_ACCESS_KEY;
    // 存储桶密码
    @Value("${minio.secretKey}")
    public String MINIO_SECRET_KEY ;

    @Bean
    public MinioClient getMinioClient() {
        return MinioClient.builder()
                .endpoint(MINIO_URL)
                .credentials(MINIO_ACCESS_KEY, MINIO_SECRET_KEY)
                .build();
    }
}
